<template>
	<view class="vip-content">
		
		<image src="@/static/index/vip-banner.png" class="bannerImg"></image>
		
		<view class="list">
			
			<view class="item" v-for="(item,index) in vipList" :key="index">
				<image :src="item.imageUrl" class="item-img" @tap="buyVip(item)" ></image>
				<view class="title">{{item.goodsName}}</view>
				<view class="price">￥{{item.nowPrice}}</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	import { memberGoodsList} from '../../api/api.js'
	export default {
		data() {
			return {
				vipList:[]
			}
		},
		onShow() {
			// 获取会员礼包列表
			this.getMemberGoodsList()
		},
		methods: {
			// 获取会员礼包列表
			getMemberGoodsList() {
				let data = {}
				memberGoodsList(data).then( res=> {
					console.log(res.data)
					this.vipList = res.data
				})
			},
			// 购买会员礼包
			buyVip(item) {
				uni.navigateTo({
					url:'/pages/index/goodsDetail?goodsId=' + item.goodsId + '&timestamp=0' + '&isVip=1'
				})
				
			},
		}
	}
</script>

<style>
page {
	background: #F6F6F8;
}
</style>

<style lang="less" scoped>
    .vip-content {
		display: flex;
		flex-direction: column;
		align-items: center;
		.bannerImg {
			width: 750rpx;
			height: 288rpx;
		}
		.list {
			width: 702rpx;
			margin-top: 24rpx;
			display: flex;
			flex-wrap: wrap;
			.item {
				width: 340rpx;
				padding-bottom: 28rpx;
				background: #fff;
				border-radius: 10rpx;
				margin-right: 22rpx;
				margin-bottom: 20rpx;
				.item-img {
					width: 340rpx;
					height: 340rpx;
				}
				.title {
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #1A1A1A;
					line-height: 39rpx;
					margin: 16rpx 0 17rpx 12rpx;
				}
				.price {
					font-family: HarmonyOS Sans, HarmonyOS Sans;
					font-weight: 500;
					font-size: 24rpx;
					color: #FA2F30;
					line-height: 24rpx;
					margin-left: 12rpx;
				}
			}
			.item:nth-child(2n) {
				margin-right: 0;
			}
		}
	}
</style>
